//
//  TeXuRegViewController.m
//  安好
//
//  Created by lianchuang on 14-12-10.
//  Copyright (c) 2014年 lianchuangbrother. All rights reserved.
//

#import "TeXuRegViewController.h"
#import "RegHospitalListViewController.h"

#define IPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)


@interface TeXuRegViewController ()<UITableViewDataSource,UITableViewDelegate>
/**
 * 左边的数据
 */
@property(nonatomic,strong)NSArray * leftDataArray;
/**
 *  左边的table
 */
@property(nonatomic,strong)UITableView * LeftTableView;
@end

@implementation TeXuRegViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadData];
    [self makeNavBar];
    [self makeTableView];
}

#pragma mark - 导航条设置
-(void)makeNavBar
{
    self.navigationItem.title = @"特需挂号";
    //左按钮--返回
    UIBarButtonItem *backBtnImg = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"公用_返回.png"] style:UIBarButtonItemStylePlain target:self action:@selector(backClicked)];
    [backBtnImg setTintColor:[UIColor whiteColor]];
    self.navigationItem.leftBarButtonItem = backBtnImg;
}

-(void)backClicked
{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)loadData
{
    self.leftDataArray = @[@"上海",@"北京",@"成都",@"武汉",@"广州"];
    
}

-(void)makeTableView
{
    self.LeftTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight-iOS7TopMargin)style:UITableViewStyleGrouped];
    [self.view addSubview:self.LeftTableView];
    self.LeftTableView.delegate = self;
    self.LeftTableView.dataSource = self;
    //隐藏横向和竖向的滑条
    self.LeftTableView.showsHorizontalScrollIndicator = NO;
    self.LeftTableView.showsVerticalScrollIndicator = NO;

    self.LeftTableView.backgroundColor = [ClassMethodsViewController colorWithHexString:BACK_BACKGROUNDCOLOR_16];
    [self.LeftTableView setSeparatorColor:[UIColor colorWithRed:221/255.0 green:221/255.0 blue:221/255.0 alpha:1]];
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.01;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.01;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
        return self.leftDataArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (IPhone6Plus) {
        return 53;
    }else{
        return 44;
    }
    
}
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"LeftID"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"LeftID"];
    }
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    cell.textLabel.text = self.leftDataArray[indexPath.row];
    
    cell.textLabel.font = [UIFont systemFontOfSize:14];
    if (IPhone6Plus) {
        cell.textLabel.font = [UIFont systemFontOfSize:16];
    }
    
    return cell;

}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    NSArray * proidCityid = @[@{@"provinceid":@"2",@"cityid":@"0"},@{@"provinceid":@"1",@"cityid":@"0"},@{@"provinceid":@"12",@"cityid":@"1201"},@{@"provinceid":@"14",@"cityid":@"1401"},@{@"provinceid":@"5",@"cityid":@"501"}];
    RegHospitalListViewController * hospitasl = [[RegHospitalListViewController alloc] init];
    hospitasl.parDic = proidCityid[indexPath.row];
    hospitasl.fromFlag = @"特需挂号";
    [self.navigationController pushViewController:hospitasl animated:YES];
    

}
@end
